package com.zmn.plat.services.impl.product.tariff.item;

import java.util.List;

import javax.annotation.Resource;

import com.zmn.plat.model.dto.product.ProductTariffRelationDTO;
import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.product.ServProductQuery;
import com.zmn.plat.model.vo.product.ServProductVO;
import com.zmn.plat.model.vo.product.tariff.TariffProductItemPriceTariffQueryVO;
import com.zmn.plat.model.vo.product.tariff.TariffProductItemPriceTariffVO;
import com.zmn.plat.model.vo.product.tariff.TariffProductRelationVO;
import com.zmn.plat.model.vo.product.tariff.item.price.ProductServiceItemExcutePriceQueryVo;
import com.zmn.plat.model.vo.product.tariff.item.price.ProductServiceItemExcutePriceResultVo;
import com.zmn.plat.persistence.interfaces.product.tariff.item.TariffProductServiceItemDao;
import com.zmn.plat.services.interfaces.product.tariff.item.TariffProductServiceItemService;

/**
 * 计价器专用的service，
 * <p>
 * 一方面是为了兼容老版本的计价器而做的冗余service，另一方面是考虑mapper文件太大了，给它瘦身
 *
 * @author tanbiao
 * @since 2019-11-21 18:57:24
 */
@Service
public class TariffProductServiceItemServiceImpl implements TariffProductServiceItemService {
    @Resource
    TariffProductServiceItemDao tariffProductFaultItemDao;

    /**
     * 获取有故障分组的计价器产品
     *
     * @param query
     * @return
     */
    @Override
    public List<ServProductVO> listPageByTariffProductIds(ServProductQuery query) {
        int count = countByTariffProductIds(query);
        query.setTotalCount(count);
        return tariffProductFaultItemDao.listPageByTariffProductIds(query);
    }

    @Override
    public List<TariffProductItemPriceTariffVO> listTariffProductItemPriceTariffByQuery(TariffProductItemPriceTariffQueryVO query) {
        return tariffProductFaultItemDao.listTariffProductItemPriceTariffByQuery(query);
    }

    @Override
    public List<ProductServiceItemExcutePriceResultVo> listByExcuteQuery(ProductServiceItemExcutePriceQueryVo query) {
        int count = countByExcuteQuery(query);
        query.setTotalCount(count);
        return tariffProductFaultItemDao.listByExcuteQuery(query);
    }

    @Override
    public List<TariffProductRelationVO> listTariffProductRelationByQuery(TariffProductItemPriceTariffQueryVO query) {
        return tariffProductFaultItemDao.listTariffProductRelationByQuery(query);
    }

    @Override
    public List<ProductServiceItemExcutePriceResultVo> listDefaultItemByRelationAndCityId(List<ProductTariffRelationDTO> ratioPriceProductList, Integer cityId) {
        return tariffProductFaultItemDao.listDefaultItemByRelationAndCityId(ratioPriceProductList,cityId);
    }

    @Override
    public List<ProductServiceItemExcutePriceResultVo> listDefaultItemByRelation(List<ProductTariffRelationDTO> list) {
        return tariffProductFaultItemDao.listDefaultItemByRelation(list);
    }

    @Override
    public Integer countByExcuteQuery(ProductServiceItemExcutePriceQueryVo query) {
        return tariffProductFaultItemDao.countByExcuteQuery(query);
    }

    @Override
    public Integer countByTariffProductIds(ServProductQuery query) {
        return tariffProductFaultItemDao.countByTariffProductIds(query);
    }

}
